package au.edu.jcu.it.numberguess;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.TextView;

public class HelpActivity extends Activity {

	private TextView tvHelp;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_help);

		tvHelp = (TextView) findViewById(R.id.tvHelpContent);
		// set home button enable
		ActionBar actionBar = getActionBar();
		actionBar.setHomeButtonEnabled(true);
		actionBar.setDisplayHomeAsUpEnabled(true);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			onBackPressed();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

	@Override
	public void onBackPressed() {
		finish();
		super.onBackPressed();
	}

	@Override
	protected void onStart() {
		tvHelp.setText("- Game mode\n1.User guess: The user guesses the App's secrect number with time constraint. The user can see each card only once in a sequence. After all cards  have been seen, the user has one chance to guess the number.\n"
				+ "2.App guess: The app guesses the user's secrect number with unlimited time. The user will have to choose 'Yes' or 'No' if the serect number is on the cards. After all selection, the app guesses the number.\n"
				+ "3.Free play: No constraints.\n\n"
				+ "* To move between the cards, swipe left or right.\n\n"
				+ ""
				+ "- Card modes\n"
				+ "There are three card number modes. Binary, Fibonacci and Prime numbers. The user can select one of the mode for playing from setting.\n\n"
				+ "- Highscores\n"
				+ "If the user won the game, the user's name will be on highscore table.\n"
				+ "For time trial, less time will be ranked higher. And for beat the clock, time consumed will be scored and less time consumed will be ranked higher.");
		super.onStart();
	}
}
